﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="VoteInfo.aspx.cs" Inherits="vote_VoteInfo" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
      <title>投票</title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
	<link rel="stylesheet" type="text/css" href="../css/stylesheet.css"/>
	<link href="../css/ecrm03.css" rel="stylesheet" type="text/css" />
    <script language="JScript" src="../js/Function.js"></script>
    <script language="JScript" src="../js/myCheck.js"></script>
    <script language="JScript" src="../jquery/126/jquery-1.2.6.js"></script>
    <script type="text/javascript" language="javascript">
        function getMonths()
        {
            var urlstring="voteinfo.aspx";
            $.ajax({
            url:urlstring,
            type:'post',
            dataType:'html',
            data:'&opration=getmonths&year='+ form1.selyear.value + '&month='+ form1.selmonth.value+'&day=' + form1.selday.value ,
            beforeSend:function()
            {
                
            },
            error:function()
            {
               
            },
            success: function(msg)
            {
                $("#selmonth > option").remove();
                var months=msg.split(',');
                for(i=0;i<months.length;i++)
                {
                    $("#selmonth").append('<option value='+ months[i]+'>'+months[i]+'</option>');
                }
                $("#selmonth > option:first-child").attr("selected","true");
                getDays();
            }
            });
        }
        function getDays()
        {
            var urlstring="voteinfo.aspx";
            $.ajax({
            url:urlstring,
            type:'post',
            dataType:'html',
            data:'&opration=getdays&year='+ form1.selyear.value + '&month='+ form1.selmonth.value+'&day='+ form1.selday.value ,
            beforeSend:function()
            {
                
            },
            error:function()
            {
                
            },
            success: function(msg)
            {
                $("#selday > option").remove();
                var days=msg.split(',');
                for(i=0;i<days.length;i++)
                {
                    $("#selday").append('<option value='+ days[i]+'>'+days[i]+'</option>');
                }
                $("#selday > option:first-child").attr("selected","true");
            }
            });
        }
        function selectEndTime(obj)
        {
            if(document.getElementById('endtime').checked)
                $("#selyear,#selmonth,#selday").show()
            else
                $("#selyear,#selmonth,#selday").hide();
        }
        
        function save()
        {
            var urlstring="voteinfo.aspx";
            var items="";
            var hassame=false;
            $.each($(".txtitem"),function(i,n){  if( $.trim(n.value) != ""){ if(items.indexOf(escape(n.value)+',')>-1){alert("选项重复，请重新输入！");n.focus();hassame=true;return false;}   items += escape(n.value)+',';}  });
            if(hassame)return;
            if( $.trim($('#txttitle').val()) == ""){ alert('请填写标题！'); return; }
            if( $.trim(items) == "" ){ alert('请填写选项！'); return; }
            
            $.ajax({
            url:urlstring,
            type:'post',
            dataType:'html',
            data:'&opration=save&title='+ escape($("#txttitle").val()) + '&items='+ items + '&description='+ escape($("#tadescription").val()) + '&type=' + $("input[@name=rdType][@checked]").val() + "&authority=false"  + '&endtime='+document.getElementById('endtime').checked +'&year='+ form1.selyear.value + '&month='+ form1.selmonth.value+'&day='+ form1.selday.value ,
            beforeSend:function()
            {
                
            },
            error:function()
            {
                
            },
            success: function(msg)
            {
                alert("投票成功！");
                location.href='vote.aspx';
            }
            });
        }
 
       
    </script>
</head>
<body>

    <form id="form1" runat="server">
    <div>
            <table width =950px align="center">
            <tr>
                <td style="width: 15px; height: 47px; background-color: #ffffff" valign="middle"></td>
                
                <td  style="background-color:#0075B0; height :47px; width: 950px;" valign="middle">
                    <DIV style="text-align: left ; font-family:Arial; text-align:left;" >
                        <span style=" font-family:'Arial Black'; color:#FFFFFF; font-size:16pt;">
                            <b>&nbsp;&nbsp;&nbsp;&nbsp;MagSpace
                                
                            </b>
                        </span>
                     </DIV>
                 </td>
                 
                 <td style="background-color:#0075B0; height :47px; width: 190px;" valign="middle" align="right">
                    <DIV style="text-align: left ; font-family:Arial; text-align:left;" >
                        <span style=" font-family:'Arial Black'; color:#FFFFFF; font-size:16pt;">
                             <span class="pl"><asp:Literal ID="userstatus1" runat="server"></asp:Literal>&nbsp;&nbsp;<asp:Literal ID="userstatus2" runat="server"></asp:Literal></span>
                             </span>
                     </DIV>
                 </td>
                 
                <td style="width: 15px; height: 47px; background-color: #ffffff" valign="middle"></td>
                    
            </tr>
        </table>
        <br />
        
        <table width=900 align="center">
            <tr>
                <td style="text-align:center" id="tab01" class="titletab02"><a href="../index.aspx">首页</a></td>
                <td class="titletab03">&nbsp;</td>
                <td style="text-align:center" id="tab03" class="titletab02"><a href="../my_ecrm.aspx">我的名片夹</a></td>
                <td class="titletab03">&nbsp;</td>
                <td style="text-align:center" id="Td1" class="titletab02"><a href="../my_givelist.aspx">我的赠刊名录</a></td>
                <td class="titletab03">&nbsp;</td>
                <td style="text-align:center" id="Td2" class="titletab02"><a href="../my_plan.aspx">我的周计划</a></td>
                <td class="titletab03">&nbsp;</td>
                <td style="text-align:center" id="Td3" class="titletab02"><a href="../easybbs.aspx">员工交流区</a></td>
                <td class="titletab03">&nbsp;</td>
                <td style="text-align:center" id="Td4" class="titletab02"><a href="../employee2.aspx">员工联系表</a></td>
                <td class="titletab03">&nbsp;</td>
                <td style="text-align:center" id="Td6" class="titletab01"><a href="../vote/vote.aspx">投票</a></td>
                <td class="titletab03">&nbsp;</td>
                <td style="text-align:center" id="Td5" class="titletab02"><a href="../webdisk/default.aspx">网盘</a></td>
                <td class="titletab04">&nbsp;</td>
            </tr>
        </table>
        
    <table cellSpacing="0" cellPadding="0" border="0" align="center">
		    <tr>
		        <td style="background-color:White;padding-right: 10px; padding-left: 10px; padding-bottom: 10px; padding-top: 10px;">
		            <table cellSpacing="0" cellPadding="0" width="500" align="center" border="0" style="background-color:White;">
		                <tr>
		                    <td style="BORDER-RIGHT: #90b0de 1px solid; BORDER-TOP: #90b0de 1px solid; BORDER-LEFT: #90b0de 1px solid; BORDER-BOTTOM: #90b0de 1px solid">
		                        <table width="100%" cellSpacing="0" cellPadding="0" align="center" border="0">
		                            <tr height="30">
		                                <td style="border-bottom: #90b0de 1px solid; font-weight: bold; color: #004499;border-bottom:1px solid silver;">&nbsp;&nbsp;&nbsp;<img src="../images/ico_rj.gif" />投票</td><td style="border-bottom: #90b0de 1px solid; font-weight: bold; color: #004499;border-bottom:1px solid silver; text-align:right"> <a href ='javascript:window.history.back();'> << 返回上一页</a></td>
		                            </tr>
		                        </table>
		                        <table >
		                            <tr>
		                                <td><a href='vote.aspx'>返回投票首页</a></td>
		                            </tr>
		                        </table>
                                <div id="mnginput" style="margin-top:10px;margin-bottom:10px;margin-left:10px;">
                                    
                                </div>
                                
                                <div style="border-top: #90b0de 1px solid;"></div>
                                <div id="mnglist" style="margin-top:10px;margin-bottom:10px;margin-left:10px;margin-right:10px;">
                                    <table border='0' width='100%' >
                                        <tr>
                                            <td style=" text-align:right;">投票主题：</td>
                                            <td><input type="text" id='txttitle' style="width:300px;" maxlength='100' /><br>填写问题，例如：我该买哪一款新手机？</td>
                                            <td>
                                                <a id="show-votedesc" href="javascript:void 0" onclick="document.getElementById('add-vote-desc').style.display = ''; this.style.display='none';">
                                                    <span style="color: #0000ff; text-decoration: underline">添加描述</span></a></td>
                                        </tr>
                                        <tr id='add-vote-desc' style="display:none">
                                            <td style="vertical-align:top; text-align:right;">投票描述：</td>
                                            <td><textarea id="tadescription" maxlength='1000' style="width:300px; height:6em; overflow:auto;" ></textarea></td>
                                            <td></td>
                                        </tr>
                                        <tr>
                                            <td style=" text-align:right;">选项1：</td>
                                            <td><input class='txtitem' type="text" id='Text1' style="width:300px;" maxlength='50' /></td>
                                            <td></td>
                                        </tr>
                                        <tr>
                                            <td style=" text-align:right;">选项2：</td>
                                            <td><input class='txtitem' type="text" id='Text2' style="width:300px;" maxlength='50' /></td>
                                            <td></td>
                                        </tr>
                                        <tr>
                                            <td style=" text-align:right;">选项3：</td>
                                            <td><input class='txtitem' type="text" id='Text3' style="width:300px;" maxlength='50' /></td>
                                            <td></td>
                                        </tr>
                                        <tr>
                                            <td style=" text-align:right;">选项4：</td>
                                            <td><input class='txtitem' type="text" id='Text4' style="width:300px;" maxlength='50' /></td>
                                            <td></td>
                                        </tr>
                                        <tr>
                                            <td style=" text-align:right;">选项5：</td>
                                            <td><input class='txtitem' type="text" id='Text5' style="width:300px;" maxlength='50' /></td>
                                            <td>
                                                <a id="vote-addmoreitem" href="javascript:void 0" onclick="$('.tr2').show(); this.style.display='none';"><span style="color: #0000ff; text-decoration: underline">
                                                    增加选项</span></a></td>
                                        </tr>
                                        <tr class='tr2'>
                                            <td style=" text-align:right;">选项6：</td>
                                            <td><input class='txtitem' type="text" id='Text6' style="width:300px;" maxlength='50' /></td>
                                            <td></td>
                                        </tr>
                                        <tr class='tr2'>
                                            <td style=" text-align:right;">选项7：</td>
                                            <td><input class='txtitem' type="text" id='Text7' style="width:300px;" maxlength='50'/></td>
                                            <td></td>
                                        </tr>
                                        <tr class='tr2'>
                                            <td style=" text-align:right;">选项8：</td>
                                            <td><input class='txtitem' type="text" id='Text8' style="width:300px;" maxlength='50'/></td>
                                            <td></td>
                                        </tr>
                                        <tr class='tr2'>
                                            <td style=" text-align:right;">选项9：</td>
                                            <td><input class='txtitem' type="text" id='Text9' style="width:300px;" maxlength='50'/></td>
                                            <td></td>
                                        </tr>
                                        <tr class='tr2'> 
                                            <td style=" text-align:right;">选项10：</td>
                                            <td><input class='txtitem' type="text" id='Text10' style="width:300px;" maxlength='50'/></td>
                                            <td>
                                                <a id="A1" href="javascript:void 0" onclick="$('.tr3').show(); this.style.display='none';"><span style="color: #0000ff; text-decoration: underline">
                                                    增加选项</span></a></td>
                                        </tr>
                                        <tr class='tr3'>
                                            <td style=" text-align:right;">选项11：</td>
                                            <td><input class='txtitem' type="text" id='Text11' style="width:300px;" maxlength='50'/></td>
                                            <td></td>
                                        </tr>
                                        <tr class='tr3'>
                                            <td style=" text-align:right;">选项12：</td>
                                            <td><input class='txtitem' type="text" id='Text12' style="width:300px;" maxlength='50'/></td>
                                            <td></td>
                                        </tr>
                                        <tr class='tr3'>
                                            <td style=" text-align:right;">选项13：</td>
                                            <td><input class='txtitem' type="text" id='Text13' style="width:300px;" maxlength='50'/></td>
                                            <td></td>
                                        </tr>
                                        <tr class='tr3'>
                                            <td style=" text-align:right;">选项14：</td>
                                            <td><input class='txtitem' type="text" id='Text14' style="width:300px;" maxlength='50'/></td>
                                            <td></td>
                                        </tr>
                                        <tr class='tr3'>
                                            <td style=" text-align:right;">选项15：</td>
                                            <td><input class='txtitem' type="text" id='Text15' style="width:300px;" maxlength='50'/></td>
                                            <td>
                                                <a id="A2" href="javascript:void 0" onclick="$('.tr4').show(); this.style.display='none';"><span style="color: #0000ff; text-decoration: underline">
                                                    增加选项</span></a></td>
                                        </tr>
                                        <tr class='tr4'>
                                            <td style=" text-align:right;">选项16：</td>
                                            <td><input class='txtitem' type="text" id='Text16' style="width:300px;" maxlength='50'/></td>
                                            <td></td>
                                        </tr>
                                        <tr class='tr4'>
                                            <td style=" text-align:right;">选项17：</td>
                                            <td><input class='txtitem' type="text" id='Text17' style="width:300px;" maxlength='50'/></td>
                                            <td></td>
                                        </tr>
                                        <tr class='tr4'>
                                            <td style=" text-align:right;">选项18：</td>
                                            <td><input class='txtitem' type="text" id='Text18' style="width:300px;" maxlength='50'/></td>
                                            <td></td>
                                        </tr>
                                        <tr class='tr4'>
                                            <td style=" text-align:right;">选项19：</td>
                                            <td><input class='txtitem' type="text" id='Text19' style="width:300px;" maxlength='50'/></td>
                                            <td></td>
                                        </tr>
                                        <tr class='tr4'>
                                            <td style=" text-align:right;">选项20：</td>
                                            <td><input class='txtitem' type="text" id='Text20' style="width:300px;" maxlength='50'/></td>
                                            <td></td>
                                        </tr>
                                        <tr>
                                            <td>
                                                投票方式：</td>
                                            <td>
                                                <input id="Radio1" name='rdType' checked="checked" type="radio" value='1' />单选
                                                <input id="Radio2" name='rdType' type="radio" value='2' />多选<br />
                                                <div><input type="checkbox" id='endtime' onclick ='selectEndTime($(this));' />截止时间<select id="selyear" onchange='getMonths();' runat="server" style="display:none">
                                                    </select>
                                                    <select id="selmonth" onchange="getDays()" runat="server" style="display:none" >
                                                    </select>
                                                    <select id="selday" runat="server" style="display:none">
                                                    </select>
                                                </div>
                                                <%--<input type="checkbox" id='ckauthority' />仅好友可见--%>
                                            </td>
                                            <td></td>
                                        </tr>
                                        <tr>
                                            <td></td>
                                            <td><input type="button" id='btsave' value='发布投票' onclick='save()' /></td>
                                            <td></td>
                                        </tr>
                                    </table>
                                </div>
                             </td>
                          </tr>
                     </table>
                 </td>
             </tr>
       </table>
            <table width=900 align="center">
                <tr>
                    <td>
                        <div style="border-bottom: darkgray 1px solid;"></div>
                        <span class="bottomfont">SEEC&copy;2008-2009 汽车中国</span>
                    </td>
                </tr>
            </table>                    
    </div>
	<div id="myhidediv" style="VISIBILITY: hidden;">
	    <asp:textbox id="colcode" runat="server" Width="2"></asp:textbox>
	</div>
        
    </form>
</body>
</html>